import 'dart:convert' show json;

import 'package:flutter_common_app/data/protection.dart';

class PlaylistData {
  PlaylistData({
    this.id,
    this.name,
    this.coverImgId,
    this.coverImgUrl,
    this.coverImgId_str,
    this.adType,
    this.userId,
    this.createTime,
    this.status,
    this.opRecommend,
    this.highQuality,
    this.newImported,
    this.updateTime,
    this.trackCount,
    this.specialType,
    this.privacy,
    this.trackUpdateTime,
    this.commentThreadId,
    this.playCount,
    this.trackNumberUpdateTime,
    this.subscribedCount,
    this.cloudTrackCount,
    this.ordered,
    this.description,
    this.tags,
    this.updateFrequency,
    this.backgroundCoverId,
    this.backgroundCoverUrl,
    this.titleImage,
    this.titleImageUrl,
    this.englishTitle,
    this.subscribers,
    this.subscribed,
    this.creator,
    this.tracks,
    this.videoIds,
    this.videos,
    this.trackIds,
    this.shareCount,
    this.commentCount,
    this.remixVideo,
  });

  factory PlaylistData.fromJson(Map<String, dynamic> jsonRes) {
    if (jsonRes == null) {
      return null;
    }

    final List<String> tags = jsonRes['tags'] is List ? <String>[] : null;
    if (tags != null) {
      for (final dynamic item in jsonRes['tags']) {
        if (item != null) {
          tryCatch(() {
            tags.add(asT<String>(item));
          });
        }
      }
    }

    final List<_SubscribersData> subscribers =
    jsonRes['subscribers'] is List ? <_SubscribersData>[] : null;
    if (subscribers != null) {
      for (final dynamic item in jsonRes['subscribers']) {
        if (item != null) {
          tryCatch(() {
            subscribers
                .add(_SubscribersData.fromJson(asT<Map<String, dynamic>>(item)));
          });
        }
      }
    }

    final List<TracksData> tracks = jsonRes['tracks'] is List ? <TracksData>[] : null;
    if (tracks != null) {
      for (final dynamic item in jsonRes['tracks']) {
        if (item != null) {
          tryCatch(() {
            tracks.add(TracksData.fromJson(asT<Map<String, dynamic>>(item)));
          });
        }
      }
    }

    final List<_TrackIdsData> trackIds =
    jsonRes['trackIds'] is List ? <_TrackIdsData>[] : null;
    if (trackIds != null) {
      for (final dynamic item in jsonRes['trackIds']) {
        if (item != null) {
          tryCatch(() {
            trackIds.add(_TrackIdsData.fromJson(asT<Map<String, dynamic>>(item)));
          });
        }
      }
    }
    return PlaylistData(
      id: asT<int>(jsonRes['id']),
      name: asT<String>(jsonRes['name']),
      coverImgId: asT<int>(jsonRes['coverImgId']),
      coverImgUrl: asT<String>(jsonRes['coverImgUrl']),
      coverImgId_str: asT<String>(jsonRes['coverImgId_str']),
      adType: asT<int>(jsonRes['adType']),
      userId: asT<int>(jsonRes['userId']),
      createTime: asT<int>(jsonRes['createTime']),
      status: asT<int>(jsonRes['status']),
      opRecommend: asT<bool>(jsonRes['opRecommend']),
      highQuality: asT<bool>(jsonRes['highQuality']),
      newImported: asT<bool>(jsonRes['newImported']),
      updateTime: asT<int>(jsonRes['updateTime']),
      trackCount: asT<int>(jsonRes['trackCount']),
      specialType: asT<int>(jsonRes['specialType']),
      privacy: asT<int>(jsonRes['privacy']),
      trackUpdateTime: asT<int>(jsonRes['trackUpdateTime']),
      commentThreadId: asT<String>(jsonRes['commentThreadId']),
      playCount: asT<int>(jsonRes['playCount']),
      trackNumberUpdateTime: asT<int>(jsonRes['trackNumberUpdateTime']),
      subscribedCount: asT<int>(jsonRes['subscribedCount']),
      cloudTrackCount: asT<int>(jsonRes['cloudTrackCount']),
      ordered: asT<bool>(jsonRes['ordered']),
      description: asT<String>(jsonRes['description']),
      tags: tags,
      updateFrequency: asT<Object>(jsonRes['updateFrequency']),
      backgroundCoverId: asT<int>(jsonRes['backgroundCoverId']),
      backgroundCoverUrl: asT<Object>(jsonRes['backgroundCoverUrl']),
      titleImage: asT<int>(jsonRes['titleImage']),
      titleImageUrl: asT<Object>(jsonRes['titleImageUrl']),
      englishTitle: asT<Object>(jsonRes['englishTitle']),
      subscribers: subscribers,
      subscribed: asT<Object>(jsonRes['subscribed']),
      creator: _Creator.fromJson(asT<Map<String, dynamic>>(jsonRes['creator'])),
      tracks: tracks,
      videoIds: asT<Object>(jsonRes['videoIds']),
      videos: asT<Object>(jsonRes['videos']),
      trackIds: trackIds,
      shareCount: asT<int>(jsonRes['shareCount']),
      commentCount: asT<int>(jsonRes['commentCount']),
      remixVideo: asT<Object>(jsonRes['remixVideo']),
    );
  }

  int id;
  String name;
  int coverImgId;
  String coverImgUrl;
  String coverImgId_str;
  int adType;
  int userId;
  int createTime;
  int status;
  bool opRecommend;
  bool highQuality;
  bool newImported;
  int updateTime;
  int trackCount;
  int specialType;
  int privacy;
  int trackUpdateTime;
  String commentThreadId;
  int playCount;
  int trackNumberUpdateTime;
  int subscribedCount;
  int cloudTrackCount;
  bool ordered;
  String description;
  List<String> tags;
  Object updateFrequency;
  int backgroundCoverId;
  Object backgroundCoverUrl;
  int titleImage;
  Object titleImageUrl;
  Object englishTitle;
  List<_SubscribersData> subscribers;
  Object subscribed;
  _Creator creator;
  List<TracksData> tracks;
  Object videoIds;
  Object videos;
  List<_TrackIdsData> trackIds;
  int shareCount;
  int commentCount;
  Object remixVideo;

  Map<String, dynamic> toJson() => <String, dynamic>{
    'id': id,
    'name': name,
    'coverImgId': coverImgId,
    'coverImgUrl': coverImgUrl,
    'coverImgId_str': coverImgId_str,
    'adType': adType,
    'userId': userId,
    'createTime': createTime,
    'status': status,
    'opRecommend': opRecommend,
    'highQuality': highQuality,
    'newImported': newImported,
    'updateTime': updateTime,
    'trackCount': trackCount,
    'specialType': specialType,
    'privacy': privacy,
    'trackUpdateTime': trackUpdateTime,
    'commentThreadId': commentThreadId,
    'playCount': playCount,
    'trackNumberUpdateTime': trackNumberUpdateTime,
    'subscribedCount': subscribedCount,
    'cloudTrackCount': cloudTrackCount,
    'ordered': ordered,
    'description': description,
    'tags': tags,
    'updateFrequency': updateFrequency,
    'backgroundCoverId': backgroundCoverId,
    'backgroundCoverUrl': backgroundCoverUrl,
    'titleImage': titleImage,
    'titleImageUrl': titleImageUrl,
    'englishTitle': englishTitle,
    'subscribers': subscribers,
    'subscribed': subscribed,
    'creator': creator,
    'tracks': tracks,
    'videoIds': videoIds,
    'videos': videos,
    'trackIds': trackIds,
    'shareCount': shareCount,
    'commentCount': commentCount,
    'remixVideo': remixVideo,
  };
  @override
  String toString() {
    return json.encode(this);
  }
}

class _SubscribersData {
  _SubscribersData({
    this.defaultAvatar,
    this.province,
    this.authStatus,
    this.followed,
    this.avatarUrl,
    this.accountStatus,
    this.gender,
    this.city,
    this.birthday,
    this.userId,
    this.userType,
    this.nickname,
    this.signature,
    this.description,
    this.detailDescription,
    this.avatarImgId,
    this.backgroundImgId,
    this.backgroundUrl,
    this.authority,
    this.mutual,
    this.expertTags,
    this.experts,
    this.djStatus,
    this.vipType,
    this.remarkName,
    this.authenticationTypes,
    this.avatarDetail,
    this.anchor,
    this.avatarImgIdStr,
    this.backgroundImgIdStr,
    this.avatarImgId_str,
  });

  factory _SubscribersData.fromJson(Map<String, dynamic> jsonRes) => jsonRes == null
      ? null
      : _SubscribersData(
    defaultAvatar: asT<bool>(jsonRes['defaultAvatar']),
    province: asT<int>(jsonRes['province']),
    authStatus: asT<int>(jsonRes['authStatus']),
    followed: asT<bool>(jsonRes['followed']),
    avatarUrl: asT<String>(jsonRes['avatarUrl']),
    accountStatus: asT<int>(jsonRes['accountStatus']),
    gender: asT<int>(jsonRes['gender']),
    city: asT<int>(jsonRes['city']),
    birthday: asT<int>(jsonRes['birthday']),
    userId: asT<int>(jsonRes['userId']),
    userType: asT<int>(jsonRes['userType']),
    nickname: asT<String>(jsonRes['nickname']),
    signature: asT<String>(jsonRes['signature']),
    description: asT<String>(jsonRes['description']),
    detailDescription: asT<String>(jsonRes['detailDescription']),
    avatarImgId: asT<int>(jsonRes['avatarImgId']),
    backgroundImgId: asT<int>(jsonRes['backgroundImgId']),
    backgroundUrl: asT<String>(jsonRes['backgroundUrl']),
    authority: asT<int>(jsonRes['authority']),
    mutual: asT<bool>(jsonRes['mutual']),
    expertTags: asT<Object>(jsonRes['expertTags']),
    experts: asT<Object>(jsonRes['experts']),
    djStatus: asT<int>(jsonRes['djStatus']),
    vipType: asT<int>(jsonRes['vipType']),
    remarkName: asT<Object>(jsonRes['remarkName']),
    authenticationTypes: asT<int>(jsonRes['authenticationTypes']),
    avatarDetail: asT<Object>(jsonRes['avatarDetail']),
    anchor: asT<bool>(jsonRes['anchor']),
    avatarImgIdStr: asT<String>(jsonRes['avatarImgIdStr']),
    backgroundImgIdStr: asT<String>(jsonRes['backgroundImgIdStr']),
    avatarImgId_str: asT<String>(jsonRes['avatarImgId_str']),
  );

  bool defaultAvatar;
  int province;
  int authStatus;
  bool followed;
  String avatarUrl;
  int accountStatus;
  int gender;
  int city;
  int birthday;
  int userId;
  int userType;
  String nickname;
  String signature;
  String description;
  String detailDescription;
  int avatarImgId;
  int backgroundImgId;
  String backgroundUrl;
  int authority;
  bool mutual;
  Object expertTags;
  Object experts;
  int djStatus;
  int vipType;
  Object remarkName;
  int authenticationTypes;
  Object avatarDetail;
  bool anchor;
  String avatarImgIdStr;
  String backgroundImgIdStr;
  String avatarImgId_str;

  Map<String, dynamic> toJson() => <String, dynamic>{
    'defaultAvatar': defaultAvatar,
    'province': province,
    'authStatus': authStatus,
    'followed': followed,
    'avatarUrl': avatarUrl,
    'accountStatus': accountStatus,
    'gender': gender,
    'city': city,
    'birthday': birthday,
    'userId': userId,
    'userType': userType,
    'nickname': nickname,
    'signature': signature,
    'description': description,
    'detailDescription': detailDescription,
    'avatarImgId': avatarImgId,
    'backgroundImgId': backgroundImgId,
    'backgroundUrl': backgroundUrl,
    'authority': authority,
    'mutual': mutual,
    'expertTags': expertTags,
    'experts': experts,
    'djStatus': djStatus,
    'vipType': vipType,
    'remarkName': remarkName,
    'authenticationTypes': authenticationTypes,
    'avatarDetail': avatarDetail,
    'anchor': anchor,
    'avatarImgIdStr': avatarImgIdStr,
    'backgroundImgIdStr': backgroundImgIdStr,
    'avatarImgId_str': avatarImgId_str,
  };
  @override
  String toString() {
    return json.encode(this);
  }
}

class _Creator {
  _Creator({
    this.defaultAvatar,
    this.province,
    this.authStatus,
    this.followed,
    this.avatarUrl,
    this.accountStatus,
    this.gender,
    this.city,
    this.birthday,
    this.userId,
    this.userType,
    this.nickname,
    this.signature,
    this.description,
    this.detailDescription,
    this.avatarImgId,
    this.backgroundImgId,
    this.backgroundUrl,
    this.authority,
    this.mutual,
    this.expertTags,
    this.experts,
    this.djStatus,
    this.vipType,
    this.remarkName,
    this.authenticationTypes,
    this.avatarDetail,
    this.anchor,
    this.avatarImgIdStr,
    this.backgroundImgIdStr,
    this.avatarImgId_str,
  });

  factory _Creator.fromJson(Map<String, dynamic> jsonRes) => jsonRes == null
      ? null
      : _Creator(
    defaultAvatar: asT<bool>(jsonRes['defaultAvatar']),
    province: asT<int>(jsonRes['province']),
    authStatus: asT<int>(jsonRes['authStatus']),
    followed: asT<bool>(jsonRes['followed']),
    avatarUrl: asT<String>(jsonRes['avatarUrl']),
    accountStatus: asT<int>(jsonRes['accountStatus']),
    gender: asT<int>(jsonRes['gender']),
    city: asT<int>(jsonRes['city']),
    birthday: asT<int>(jsonRes['birthday']),
    userId: asT<int>(jsonRes['userId']),
    userType: asT<int>(jsonRes['userType']),
    nickname: asT<String>(jsonRes['nickname']),
    signature: asT<String>(jsonRes['signature']),
    description: asT<String>(jsonRes['description']),
    detailDescription: asT<String>(jsonRes['detailDescription']),
    avatarImgId: asT<int>(jsonRes['avatarImgId']),
    backgroundImgId: asT<int>(jsonRes['backgroundImgId']),
    backgroundUrl: asT<String>(jsonRes['backgroundUrl']),
    authority: asT<int>(jsonRes['authority']),
    mutual: asT<bool>(jsonRes['mutual']),
    expertTags: asT<Object>(jsonRes['expertTags']),
    experts: asT<Object>(jsonRes['experts']),
    djStatus: asT<int>(jsonRes['djStatus']),
    vipType: asT<int>(jsonRes['vipType']),
    remarkName: asT<Object>(jsonRes['remarkName']),
    authenticationTypes: asT<int>(jsonRes['authenticationTypes']),
    avatarDetail: AvatarDetailData.fromJson(
        asT<Map<String, dynamic>>(jsonRes['avatarDetail'])),
    anchor: asT<bool>(jsonRes['anchor']),
    avatarImgIdStr: asT<String>(jsonRes['avatarImgIdStr']),
    backgroundImgIdStr: asT<String>(jsonRes['backgroundImgIdStr']),
    avatarImgId_str: asT<String>(jsonRes['avatarImgId_str']),
  );

  bool defaultAvatar;
  int province;
  int authStatus;
  bool followed;
  String avatarUrl;
  int accountStatus;
  int gender;
  int city;
  int birthday;
  int userId;
  int userType;
  String nickname;
  String signature;
  String description;
  String detailDescription;
  int avatarImgId;
  int backgroundImgId;
  String backgroundUrl;
  int authority;
  bool mutual;
  Object expertTags;
  Object experts;
  int djStatus;
  int vipType;
  Object remarkName;
  int authenticationTypes;
  AvatarDetailData avatarDetail;
  bool anchor;
  String avatarImgIdStr;
  String backgroundImgIdStr;
  String avatarImgId_str;

  Map<String, dynamic> toJson() => <String, dynamic>{
    'defaultAvatar': defaultAvatar,
    'province': province,
    'authStatus': authStatus,
    'followed': followed,
    'avatarUrl': avatarUrl,
    'accountStatus': accountStatus,
    'gender': gender,
    'city': city,
    'birthday': birthday,
    'userId': userId,
    'userType': userType,
    'nickname': nickname,
    'signature': signature,
    'description': description,
    'detailDescription': detailDescription,
    'avatarImgId': avatarImgId,
    'backgroundImgId': backgroundImgId,
    'backgroundUrl': backgroundUrl,
    'authority': authority,
    'mutual': mutual,
    'expertTags': expertTags,
    'experts': experts,
    'djStatus': djStatus,
    'vipType': vipType,
    'remarkName': remarkName,
    'authenticationTypes': authenticationTypes,
    'avatarDetail': avatarDetail,
    'anchor': anchor,
    'avatarImgIdStr': avatarImgIdStr,
    'backgroundImgIdStr': backgroundImgIdStr,
    'avatarImgId_str': avatarImgId_str,
  };
  @override
  String toString() {
    return json.encode(this);
  }
}

class AvatarDetailData {
  AvatarDetailData({
    this.userType,
    this.identityLevel,
    this.identityIconUrl,
  });

  factory AvatarDetailData.fromJson(Map<String, dynamic> jsonRes) => jsonRes == null
      ? null
      : AvatarDetailData(
    userType: asT<int>(jsonRes['userType']),
    identityLevel: asT<int>(jsonRes['identityLevel']),
    identityIconUrl: asT<String>(jsonRes['identityIconUrl']),
  );

  int userType;
  int identityLevel;
  String identityIconUrl;

  Map<String, dynamic> toJson() => <String, dynamic>{
    'userType': userType,
    'identityLevel': identityLevel,
    'identityIconUrl': identityIconUrl,
  };
  @override
  String toString() {
    return json.encode(this);
  }
}

class TracksData {
  TracksData({
    this.name,
    this.id,
    this.pst,
    this.t,
    this.ar,
    this.alia,
    this.pop,
    this.st,
    this.rt,
    this.fee,
    this.v,
    this.crbt,
    this.cf,
    this.al,
    this.dt,
    this.h,
    this.m,
    this.l,
    this.a,
    this.cd,
    this.no,
    this.rtUrl,
    this.ftype,
    this.rtUrls,
    this.djId,
    this.copyright,
    this.s_id,
    this.mark,
    this.originCoverType,
    this.originSongSimpleData,
    this.single,
    this.noCopyrightRcmd,
    this.mst,
    this.cp,
    this.mv,
    this.rtype,
    this.rurl,
    this.publishTime,
  });

  factory TracksData.fromJson(Map<String, dynamic> jsonRes) {
    if (jsonRes == null) {
      return null;
    }

    final List<_Ar> ar = jsonRes['ar'] is List ? <_Ar>[] : null;
    if (ar != null) {
      for (final dynamic item in jsonRes['ar']) {
        if (item != null) {
          tryCatch(() {
            ar.add(_Ar.fromJson(asT<Map<String, dynamic>>(item)));
          });
        }
      }
    }

    final List<Object> alia = jsonRes['alia'] is List ? <Object>[] : null;
    if (alia != null) {
      for (final dynamic item in jsonRes['alia']) {
        if (item != null) {
          tryCatch(() {
            alia.add(asT<Object>(item));
          });
        }
      }
    }

    final List<Object> rtUrls = jsonRes['rtUrls'] is List ? <Object>[] : null;
    if (rtUrls != null) {
      for (final dynamic item in jsonRes['rtUrls']) {
        if (item != null) {
          tryCatch(() {
            rtUrls.add(asT<Object>(item));
          });
        }
      }
    }
    return TracksData(
      name: asT<String>(jsonRes['name']),
      id: asT<int>(jsonRes['id']),
      pst: asT<int>(jsonRes['pst']),
      t: asT<int>(jsonRes['t']),
      ar: ar,
      alia: alia,
      pop: asT<int>(jsonRes['pop']),
      st: asT<int>(jsonRes['st']),
      rt: asT<String>(jsonRes['rt']),
      fee: asT<int>(jsonRes['fee']),
      v: asT<int>(jsonRes['v']),
      crbt: asT<Object>(jsonRes['crbt']),
      cf: asT<String>(jsonRes['cf']),
      al: _Al.fromJson(asT<Map<String, dynamic>>(jsonRes['al'])),
      dt: asT<int>(jsonRes['dt']),
      h: _H.fromJson(asT<Map<String, dynamic>>(jsonRes['h'])),
      m: _M.fromJson(asT<Map<String, dynamic>>(jsonRes['m'])),
      l: _L.fromJson(asT<Map<String, dynamic>>(jsonRes['l'])),
      a: asT<Object>(jsonRes['a']),
      cd: asT<String>(jsonRes['cd']),
      no: asT<int>(jsonRes['no']),
      rtUrl: asT<Object>(jsonRes['rtUrl']),
      ftype: asT<int>(jsonRes['ftype']),
      rtUrls: rtUrls,
      djId: asT<int>(jsonRes['djId']),
      copyright: asT<int>(jsonRes['copyright']),
      s_id: asT<int>(jsonRes['s_id']),
      mark: asT<int>(jsonRes['mark']),
      originCoverType: asT<int>(jsonRes['originCoverType']),
      originSongSimpleData: asT<Object>(jsonRes['originSongSimpleData']),
      single: asT<int>(jsonRes['single']),
      noCopyrightRcmd: asT<Object>(jsonRes['noCopyrightRcmd']),
      mst: asT<int>(jsonRes['mst']),
      cp: asT<int>(jsonRes['cp']),
      mv: asT<int>(jsonRes['mv']),
      rtype: asT<int>(jsonRes['rtype']),
      rurl: asT<Object>(jsonRes['rurl']),
      publishTime: asT<int>(jsonRes['publishTime']),
    );
  }

  String name;
  int id;
  int pst;
  int t;
  List<_Ar> ar;
  List<Object> alia;
  int pop;
  int st;
  String rt;
  int fee;
  int v;
  Object crbt;
  String cf;
  _Al al;
  int dt;
  _H h;
  _M m;
  _L l;
  Object a;
  String cd;
  int no;
  Object rtUrl;
  int ftype;
  List<Object> rtUrls;
  int djId;
  int copyright;
  int s_id;
  int mark;
  int originCoverType;
  Object originSongSimpleData;
  int single;
  Object noCopyrightRcmd;
  int mst;
  int cp;
  int mv;
  int rtype;
  Object rurl;
  int publishTime;

  Map<String, dynamic> toJson() => <String, dynamic>{
    'name': name,
    'id': id,
    'pst': pst,
    't': t,
    'ar': ar,
    'alia': alia,
    'pop': pop,
    'st': st,
    'rt': rt,
    'fee': fee,
    'v': v,
    'crbt': crbt,
    'cf': cf,
    'al': al,
    'dt': dt,
    'h': h,
    'm': m,
    'l': l,
    'a': a,
    'cd': cd,
    'no': no,
    'rtUrl': rtUrl,
    'ftype': ftype,
    'rtUrls': rtUrls,
    'djId': djId,
    'copyright': copyright,
    's_id': s_id,
    'mark': mark,
    'originCoverType': originCoverType,
    'originSongSimpleData': originSongSimpleData,
    'single': single,
    'noCopyrightRcmd': noCopyrightRcmd,
    'mst': mst,
    'cp': cp,
    'mv': mv,
    'rtype': rtype,
    'rurl': rurl,
    'publishTime': publishTime,
  };
  @override
  String toString() {
    return json.encode(this);
  }
}

class _Ar {
  _Ar({
    this.id,
    this.name,
    this.tns,
    this.alias,
  });

  factory _Ar.fromJson(Map<String, dynamic> jsonRes) {
    if (jsonRes == null) {
      return null;
    }

    final List<Object> tns = jsonRes['tns'] is List ? <Object>[] : null;
    if (tns != null) {
      for (final dynamic item in jsonRes['tns']) {
        if (item != null) {
          tryCatch(() {
            tns.add(asT<Object>(item));
          });
        }
      }
    }

    final List<Object> alias = jsonRes['alias'] is List ? <Object>[] : null;
    if (alias != null) {
      for (final dynamic item in jsonRes['alias']) {
        if (item != null) {
          tryCatch(() {
            alias.add(asT<Object>(item));
          });
        }
      }
    }
    return _Ar(
      id: asT<int>(jsonRes['id']),
      name: asT<String>(jsonRes['name']),
      tns: tns,
      alias: alias,
    );
  }

  int id;
  String name;
  List<Object> tns;
  List<Object> alias;

  Map<String, dynamic> toJson() => <String, dynamic>{
    'id': id,
    'name': name,
    'tns': tns,
    'alias': alias,
  };
  @override
  String toString() {
    return json.encode(this);
  }
}

class _Al {
  _Al({
    this.id,
    this.name,
    this.picUrl,
    this.tns,
    this.pic_str,
    this.pic,
  });

  factory _Al.fromJson(Map<String, dynamic> jsonRes) {
    if (jsonRes == null) {
      return null;
    }

    final List<Object> tns = jsonRes['tns'] is List ? <Object>[] : null;
    if (tns != null) {
      for (final dynamic item in jsonRes['tns']) {
        if (item != null) {
          tryCatch(() {
            tns.add(asT<Object>(item));
          });
        }
      }
    }
    return _Al(
      id: asT<int>(jsonRes['id']),
      name: asT<String>(jsonRes['name']),
      picUrl: asT<String>(jsonRes['picUrl']),
      tns: tns,
      pic_str: asT<String>(jsonRes['pic_str']),
      pic: asT<int>(jsonRes['pic']),
    );
  }

  int id;
  String name;
  String picUrl;
  List<Object> tns;
  String pic_str;
  int pic;

  Map<String, dynamic> toJson() => <String, dynamic>{
    'id': id,
    'name': name,
    'picUrl': picUrl,
    'tns': tns,
    'pic_str': pic_str,
    'pic': pic,
  };
  @override
  String toString() {
    return json.encode(this);
  }
}

class _H {
  _H({
    this.br,
    this.fid,
    this.size,
    this.vd,
  });

  factory _H.fromJson(Map<String, dynamic> jsonRes) => jsonRes == null
      ? null
      : _H(
    br: asT<int>(jsonRes['br']),
    fid: asT<int>(jsonRes['fid']),
    size: asT<int>(jsonRes['size']),
    vd: asT<int>(jsonRes['vd']),
  );

  int br;
  int fid;
  int size;
  int vd;

  Map<String, dynamic> toJson() => <String, dynamic>{
    'br': br,
    'fid': fid,
    'size': size,
    'vd': vd,
  };
  @override
  String toString() {
    return json.encode(this);
  }
}

class _M {
  _M({
    this.br,
    this.fid,
    this.size,
    this.vd,
  });

  factory _M.fromJson(Map<String, dynamic> jsonRes) => jsonRes == null
      ? null
      : _M(
    br: asT<int>(jsonRes['br']),
    fid: asT<int>(jsonRes['fid']),
    size: asT<int>(jsonRes['size']),
    vd: asT<int>(jsonRes['vd']),
  );

  int br;
  int fid;
  int size;
  int vd;

  Map<String, dynamic> toJson() => <String, dynamic>{
    'br': br,
    'fid': fid,
    'size': size,
    'vd': vd,
  };
  @override
  String toString() {
    return json.encode(this);
  }
}

class _L {
  _L({
    this.br,
    this.fid,
    this.size,
    this.vd,
  });

  factory _L.fromJson(Map<String, dynamic> jsonRes) => jsonRes == null
      ? null
      : _L(
    br: asT<int>(jsonRes['br']),
    fid: asT<int>(jsonRes['fid']),
    size: asT<int>(jsonRes['size']),
    vd: asT<int>(jsonRes['vd']),
  );

  int br;
  int fid;
  int size;
  int vd;

  Map<String, dynamic> toJson() => <String, dynamic>{
    'br': br,
    'fid': fid,
    'size': size,
    'vd': vd,
  };
  @override
  String toString() {
    return json.encode(this);
  }
}

class _TrackIdsData {
  _TrackIdsData({
    this.id,
    this.v,
    this.t,
    this.at,
    this.alg,
  });

  factory _TrackIdsData.fromJson(Map<String, dynamic> jsonRes) => jsonRes == null
      ? null
      : _TrackIdsData(
    id: asT<int>(jsonRes['id']),
    v: asT<int>(jsonRes['v']),
    t: asT<int>(jsonRes['t']),
    at: asT<int>(jsonRes['at']),
    alg: asT<Object>(jsonRes['alg']),
  );

  int id;
  int v;
  int t;
  int at;
  Object alg;

  Map<String, dynamic> toJson() => <String, dynamic>{
    'id': id,
    'v': v,
    't': t,
    'at': at,
    'alg': alg,
  };
  @override
  String toString() {
    return json.encode(this);
  }
}

class _PrivilegesData {
  _PrivilegesData({
    this.id,
    this.fee,
    this.payed,
    this.realPayed,
    this.st,
    this.pl,
    this.dl,
    this.sp,
    this.cp,
    this.subp,
    this.cs,
    this.maxbr,
    this.fl,
    this.pc,
    this.toast,
    this.flag,
    this.paidBigBang,
    this.preSell,
    this.playMaxbr,
    this.downloadMaxbr,
    this.freeTrialPrivilege,
    this.chargeInfoList,
  });

  factory _PrivilegesData.fromJson(Map<String, dynamic> jsonRes) {
    if (jsonRes == null) {
      return null;
    }

    final List<_ChargeInfoListData> chargeInfoList =
    jsonRes['chargeInfoList'] is List ? <_ChargeInfoListData>[] : null;
    if (chargeInfoList != null) {
      for (final dynamic item in jsonRes['chargeInfoList']) {
        if (item != null) {
          tryCatch(() {
            chargeInfoList
                .add(_ChargeInfoListData.fromJson(asT<Map<String, dynamic>>(item)));
          });
        }
      }
    }
    return _PrivilegesData(
      id: asT<int>(jsonRes['id']),
      fee: asT<int>(jsonRes['fee']),
      payed: asT<int>(jsonRes['payed']),
      realPayed: asT<int>(jsonRes['realPayed']),
      st: asT<int>(jsonRes['st']),
      pl: asT<int>(jsonRes['pl']),
      dl: asT<int>(jsonRes['dl']),
      sp: asT<int>(jsonRes['sp']),
      cp: asT<int>(jsonRes['cp']),
      subp: asT<int>(jsonRes['subp']),
      cs: asT<bool>(jsonRes['cs']),
      maxbr: asT<int>(jsonRes['maxbr']),
      fl: asT<int>(jsonRes['fl']),
      pc: asT<Object>(jsonRes['pc']),
      toast: asT<bool>(jsonRes['toast']),
      flag: asT<int>(jsonRes['flag']),
      paidBigBang: asT<bool>(jsonRes['paidBigBang']),
      preSell: asT<bool>(jsonRes['preSell']),
      playMaxbr: asT<int>(jsonRes['playMaxbr']),
      downloadMaxbr: asT<int>(jsonRes['downloadMaxbr']),
      freeTrialPrivilege: _FreeTrialPrivilegeData.fromJson(
          asT<Map<String, dynamic>>(jsonRes['freeTrialPrivilege'])),
      chargeInfoList: chargeInfoList,
    );
  }

  int id;
  int fee;
  int payed;
  int realPayed;
  int st;
  int pl;
  int dl;
  int sp;
  int cp;
  int subp;
  bool cs;
  int maxbr;
  int fl;
  Object pc;
  bool toast;
  int flag;
  bool paidBigBang;
  bool preSell;
  int playMaxbr;
  int downloadMaxbr;
  _FreeTrialPrivilegeData freeTrialPrivilege;
  List<_ChargeInfoListData> chargeInfoList;

  Map<String, dynamic> toJson() => <String, dynamic>{
    'id': id,
    'fee': fee,
    'payed': payed,
    'realPayed': realPayed,
    'st': st,
    'pl': pl,
    'dl': dl,
    'sp': sp,
    'cp': cp,
    'subp': subp,
    'cs': cs,
    'maxbr': maxbr,
    'fl': fl,
    'pc': pc,
    'toast': toast,
    'flag': flag,
    'paidBigBang': paidBigBang,
    'preSell': preSell,
    'playMaxbr': playMaxbr,
    'downloadMaxbr': downloadMaxbr,
    'freeTrialPrivilege': freeTrialPrivilege,
    'chargeInfoList': chargeInfoList,
  };
  @override
  String toString() {
    return json.encode(this);
  }
}

class _FreeTrialPrivilegeData {
  _FreeTrialPrivilegeData({
    this.resConsumable,
    this.userConsumable,
  });

  factory _FreeTrialPrivilegeData.fromJson(Map<String, dynamic> jsonRes) =>
      jsonRes == null
          ? null
          : _FreeTrialPrivilegeData(
        resConsumable: asT<bool>(jsonRes['resConsumable']),
        userConsumable: asT<bool>(jsonRes['userConsumable']),
      );

  bool resConsumable;
  bool userConsumable;

  Map<String, dynamic> toJson() => <String, dynamic>{
    'resConsumable': resConsumable,
    'userConsumable': userConsumable,
  };
  @override
  String toString() {
    return json.encode(this);
  }
}

class _ChargeInfoListData {
  _ChargeInfoListData({
    this.rate,
    this.chargeUrl,
    this.chargeMessage,
    this.chargeType,
  });

  factory _ChargeInfoListData.fromJson(Map<String, dynamic> jsonRes) =>
      jsonRes == null
          ? null
          : _ChargeInfoListData(
        rate: asT<int>(jsonRes['rate']),
        chargeUrl: asT<Object>(jsonRes['chargeUrl']),
        chargeMessage: asT<Object>(jsonRes['chargeMessage']),
        chargeType: asT<int>(jsonRes['chargeType']),
      );

  int rate;
  Object chargeUrl;
  Object chargeMessage;
  int chargeType;

  Map<String, dynamic> toJson() => <String, dynamic>{
    'rate': rate,
    'chargeUrl': chargeUrl,
    'chargeMessage': chargeMessage,
    'chargeType': chargeType,
  };
  @override
  String toString() {
    return json.encode(this);
  }
}
